home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1199 / 1073 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  7.8 KB

  1. Subject: Re: MiNT 1.10 biosfs select() patch
  2. Date: Sat, 19 Feb 94 1:46:32 CET
  3. From: Juergen Lock <nox@jelal.north.de>
  4. In-Reply-To: <199402172223.AA06552@techfac.TechFak.Uni-Bielefeld.DE>; from "Torsten Scherer" at Feb 17, 94 11:13 pm
  5. Message-Id: <9402190046.AA00186@jelal.north.de>
  6.  
  7. Torsten Scherer writes:
  8.  
  9. >  Ok, forget what I was telling some hours ago. The chunks came from the vcon
  10. > daemon from Juergen Lock.
  11.  
  12.  yea because its select never woke up before timeout...
  13.  
  14. >  Without the vcons, it doesn't work at all!
  15.  
  16.  aah so they are at least useful for something. ;)
  17.  
  18. > Looks like you can still read characters from /dev/console, but select
  19. > doesn't work any longer. When tracking this down, I found this:
  20. > diff -u3 orig/biosfs.c ./biosfs.c
  21. > --- orig/biosfs.c    Thu Feb 17 16:55:00 1994
  22. > +++ ./biosfs.c    Thu Feb 17 23:04:10 1994
  23. > @@ -1542,7 +1542,7 @@
  24. >          }
  25. >          if (tty) {
  26. >          /* avoid collisions with other processes */
  27. > -            if (!tty->rsel)
  28. > +            if (tty->rsel)
  29. >                  return 2;    /* collision */
  30. >              tty->rsel = p;
  31. >          }
  32. > @@ -1553,7 +1553,7 @@
  33. >              return 1;
  34. >          }
  35. >          if (tty) {
  36. > -            if (!tty->wsel)
  37. > +            if (tty->wsel)
  38. >                  return 2;    /* collision */
  39. >              tty->wsel = p;
  40. >          }
  41.  
  42.  thats number one...
  43.  
  44. 2.
  45. intr.spp: ++nox@jelal.north.de
  46.     Check for auto-repeating keys so that Fselect() wakes up more
  47.     quickly.
  48.  
  49. this was the wrong patch, the right one came a few days later...
  50.  
  51. Index: intr.spp
  52. @@ -60,9 +60,6 @@
  53.      move.l    _old_timer+8,-(sp)    ; jump to GEMDOS time vector
  54.      rts
  55.  
  56. -    XREF    _kintr
  57. -    XREF    _keyrec
  58. -
  59.  _mint_vbl:
  60.  %ifndef ONLY030
  61.      tst.w    ($59e).w        ; test longframe (AKP)
  62. @@ -76,11 +73,6 @@
  63.      rts
  64.  
  65.  L_comeback:
  66. -    move.w    d0,-(sp)        ; `repeated' keys don't generate
  67. -    move.w    _keyrec+8,d0        ; interrupts...  check buffer and
  68. -    cmp.w    _keyrec+6,d0        ; set hi byte of kintr so that
  69. -    sne    _kintr            ; select can wake up before you
  70. -    move.w    (sp)+,d0        ; release the key, etc.
  71.      tst.w    _proc_clock        ; has time expired yet?
  72.      beq.s    L_expired        ; yes -- maybe go switch processes
  73.  L_out:
  74. Index: timeout.c
  75. @@ -140,6 +140,10 @@
  76.   * suspends the current process
  77.   */
  78.  
  79. +/* variables for monitoring the keyboard */
  80. +extern IOREC_T    *keyrec;    /* keyboard i/o record pointer */
  81. +extern short    kintr;        /* keyboard interrupt pending (see intr.s) */
  82. +
  83.  volatile int our_clock = 1000;
  84.  
  85.  void ARGS_ON_STACK
  86. @@ -147,6 +151,8 @@
  87.  {
  88.      int ms;        /* time between ticks */
  89.  
  90. +    *(char *)&kintr = (keyrec->head != keyrec->tail) ? -1 : 0;
  91. +
  92.      ms = *((short *)0x442L);
  93.      if (proc_clock > 0)
  94.          proc_clock--;
  95.  
  96. 3. (another select patch, not fatal)
  97.  
  98. Index: fasttext.c
  99. @@ -1379,8 +1379,9 @@
  100.          }
  101.          if (tty) {
  102.          /* avoid collisions with other processes */
  103. -            if (!tty->rsel)
  104. -                tty->rsel = p;
  105. +            if (tty->rsel)
  106. +                return 2;
  107. +            tty->rsel = p;
  108.          }
  109.          return 0;
  110.      } else if (mode == O_WRONLY) {
  111.  
  112. 4.
  113. debug.c: ++nox@jelal.north.de
  114.     Make only ctrl-alt-key characters significant to the
  115.     debug code (before, any character could start/stop output).
  116.  
  117. without this non-ctrl-alt keys were still eaten:
  118.  
  119. Index: debug.c
  120. @@ -271,6 +271,7 @@
  121.              do_func_key(scan);
  122.              goto ptoggle;
  123.              }
  124. +            else goto cont;
  125.          }
  126.          else {
  127.              key = Bconin(out_device);
  128. @@ -288,6 +289,7 @@
  129.          }
  130.          }
  131.      }
  132. +cont:
  133.      s++;
  134.      }
  135.  }
  136.  
  137. 5. entropys zeroed-tty-pgroup fix...
  138.  
  139. Index: dosmem.c
  140. @@ -748,6 +748,7 @@
  141.          }
  142.      }
  143.  
  144. +#if 0
  145.  /* release the controlling terminal, if we're a process group leader */
  146.      fp = curproc->handle[-1];
  147.      if (fp && is_terminal(fp) && curproc->pgrp == curproc->pid) {
  148. @@ -755,6 +756,7 @@
  149.          if (curproc->pgrp == tty->pgrp)
  150.              tty->pgrp = 0;
  151.      }
  152. +#endif
  153.  
  154.  /* close all files */
  155.      for (i = MIN_HANDLE; i < MAX_OPEN; i++) {
  156.  
  157. 6. and some older ones...
  158.  
  159. diff -uw ../fasttext.c ./fasttext.c
  160. --- ./fasttext.c    Thu Jun 24 20:36:16 1993
  161. +++ ./fasttext.c    Sat Jun 26 02:09:56 1993
  162. @@ -1058,7 +1058,15 @@
  163.      SCREEN *v;
  164.      int c;
  165.  {
  166. +#if 0
  167.      gotoxy(v, c - ' ', escy1 - ' ');
  168. +#else
  169. +    /* some (un*x) termcaps seem to always set the hi bit on
  170. +       cm args (cm=\EY%+ %+ :) -> drop that unless the screen
  171. +       is bigger.    -nox
  172. +    */
  173. +    gotoxy(v, (c - ' ') & (v->maxx|0x7f), (escy1 - ' ') & (v->maxy|0x7f));
  174. +#endif
  175.      state = normal_putch;
  176.  }
  177.  
  178. diff -uw ../intr.spp ./intr.spp
  179. --- ./intr.spp    Sat Jun 26 01:08:18 1993
  180. +++ ./intr.spp    Sat Jun 26 01:20:54 1993
  181. @@ -272,6 +272,10 @@
  182.      move.l    _sig_routine,a1        ; get handler
  183.      jsr    (a1)            ; go do it
  184.      movem.l    (sp)+,d0-d2/a0-a2
  185. +; 68000 processor bug: rte right after movem can eat interrupts...
  186. +%ifndef ONLY030
  187. +    nop
  188. +%endif
  189.      rte
  190.  
  191.  ;
  192.  
  193. including our neverending story...  the 1.10 version of the select-xkey fix. :)
  194.  
  195. Index: console.c
  196. @@ -8,6 +8,8 @@
  197.  
  198.  #include "mint.h"
  199.  
  200. +extern char vt52xkey[];
  201. +
  202.  /*
  203.   * These routines are what Cconout, Cauxout, etc. ultimately call.
  204.   * They take an integer argument which is the user's file handle,
  205. @@ -28,6 +30,14 @@
  206.      }
  207.      r = 1;        /* default is to assume input waiting (e.g. TOS files)*/
  208.      (void)(*f->dev->ioctl)(f, FIONREAD, &r);
  209. +
  210. +    if (!r && is_terminal(f)) {
  211. +        struct tty *tty = (struct tty *)f->devinfo;
  212. +        int scan = tty->state & TS_ESC;
  213. +
  214. +        if (scan && (tty->xkey ? tty->xkey[scan] : vt52xkey[scan]))
  215. +            r = 1;
  216. +    }
  217.      return r;
  218.  }
  219.  
  220. Index: dosfile.c
  221. @@ -8,6 +8,8 @@
  222.  
  223.  #include "mint.h"
  224.  
  225. +extern char vt52xkey[];
  226. +
  227.  static long do_dup P_((int,int));
  228.  static void unselectme P_((PROC *));
  229.  
  230. @@ -928,6 +930,14 @@
  231.          r = (*f->dev->ioctl)(f, cmd, (void *)arg);
  232.          if (r == EINVFN && is_terminal(f)) {
  233.              r = tty_ioctl(f, cmd, (void *)arg);
  234. +        } else if (cmd == FIONREAD && !r && !(*(long *)arg) &&
  235. +                is_terminal(f)) {
  236. +            struct tty *tty = (struct tty *)f->devinfo;
  237. +            int scan = tty->state & TS_ESC;
  238. +
  239. +            if (scan && (tty->xkey ? tty->xkey[scan] :
  240. +                    vt52xkey[scan]))
  241. +                *(long *)arg = 1;
  242.          }
  243.          return r;
  244.      }
  245. @@ -1010,8 +1020,15 @@
  246.  
  247.      for (i = 0; i < MAX_OPEN; i++) {
  248.          if (rfd & mask) {
  249. +            struct tty *tty;
  250. +            int scan;
  251. +
  252.              f = p->handle[i];
  253. -            if ((*f->dev->select)(f, (long)p, O_RDONLY) == 1) {
  254. +            if ((*f->dev->select)(f, (long)p, O_RDONLY) == 1 ||
  255. +                (is_terminal(f) &&
  256. +                (scan = (tty=(struct tty *)f->devinfo)->state & TS_ESC) &&
  257. +                (tty->xkey ? tty->xkey[scan] :
  258. +                    vt52xkey[scan]))) {
  259.                  count++;
  260.                  *rfdp |= mask;
  261.              }
  262. Index: tty.c
  263. @@ -233,7 +233,7 @@
  264.  
  265.  /* for RAW mode, if there are no more characters then break */
  266.          if ( (mode & (T_RAW|T_CBREAK)) &&
  267. -            !((rdmode & ESCSEQ) && (tty->state & TS_ESC))) {
  268. +            !(tty->state & TS_ESC)) {
  269.              r = 1;
  270.              (void)(*f->dev->ioctl)(f, FIONREAD, &r);
  271.              if (r <= 0) break;
  272. @@ -375,7 +375,7 @@
  273.   *        28-31 are shift+cursor up, down, right, and left
  274.   */
  275.  
  276. -static char vt52xkey[256] = {
  277. +char vt52xkey[256] = {
  278.  '\033', 'P', 0, 0, 0, 0, 0, 0,
  279.  '\033', 'Q', 0, 0, 0, 0, 0, 0,
  280.  '\033', 'R', 0, 0, 0, 0, 0, 0,
  281. @@ -665,19 +665,15 @@
  282.  /* we may be in the middle of an escape sequence */
  283.      scan = (tty->state & TS_ESC);
  284.      if (scan != 0) {
  285. -        if (mode & ESCSEQ) {
  286. -            tab = tty->xkey ? tty->xkey : vt52xkey;
  287. -            r = (unsigned char) tab[scan++];
  288. -            if (r) {
  289. -                c = UNDEF;
  290. -                if (tab[scan] == 0) scan = 0;
  291. -            }
  292. -            else
  293. -                scan = 0;
  294. -            tty->state = (tty->state & ~TS_ESC) | scan;
  295. +        tab = tty->xkey ? tty->xkey : vt52xkey;
  296. +        r = (unsigned char) tab[scan++];
  297. +        if (r) {
  298. +            c = UNDEF;
  299. +            if (tab[scan] == 0) scan = 0;
  300.          }
  301.          else
  302. -            tty->state &= ~TS_ESC;
  303. +            scan = 0;
  304. +        tty->state = (tty->state & ~TS_ESC) | scan;
  305.      }
  306.  
  307.      while (c != UNDEF) {
  308.  
  309.  ok happy patching...
  310.     Juergen
  311.  
  312. PS:  i got a few mysterious crashes and once even saw a `kfree: memory
  313. not allocated by kmalloc' panic...  went something wrong with the nalloc
  314. fixes?  because my patched 1.09 never did that since...
  315.  
  316. util.c: ++schwab@ls5.informatik.uni-dortmund.de
  317.     In kmalloc(), the size passed to nalloc_add_arena() was wrong.
  318.  
  319. nalloc2.c: ++nox@jelal.north.de
  320.     Fixed the code for figuring out when to free an arena (it didn't
  321.     use to take account of the arena size itself).
  322.  
  323. PPS: yuo may get a few offsets, they are ok.
  324. -- 
  325. J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
  326.                                 ...ohne Gewehr
  327. PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA 
  328.